-
Notifications
You must be signed in to change notification settings - Fork 659
Port some more truncation check related code #1373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Ports additional truncation-check features and refactors type-to-string logic, while updating submodule compiler snapshots.
- Refactors
mapToTypeNodes
to support truncation flags and adds corresponding truncation handling. - Switches from
typeToStringEx
to a simplertypeToString
helper and replacesvisitedTypes
map withcollections.Set
. - Updates submodule compiler baselines for namespace disambiguation and computed-name declaration emit tests, and adds AST pooling for intersection-type nodes.
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
internal/collections/multimap.go | Added Values() method to MultiMap |
internal/checker/relater.go | Replaced typeToStringEx calls with typeToString |
internal/checker/printer.go | Introduced typeToString helper and updated TypeToString |
internal/checker/nodebuilderimpl.go | Refactored mapToTypeNodes , added truncation logic, changed visitedTypes type |
internal/checker/nodebuilder.go | Removed visitedTypes map initialization |
internal/ast/ast.go | Added pooling support for IntersectionTypeNode |
testdata/baselines/reference/submodule/compiler/namespaceDisambiguationInUnion.errors.txt | Updated expected error messages |
testdata/baselines/reference/submodule/compiler/declarationEmitSimpleComputedNames1.js | Fixed computed-names declaration emit baselines |
testdata/baselines/reference/submodule/compiler/declarationEmitClassMemberWithComputedPropertyName.js | Adjusted computed-property declaration emit baselines |
Comments suppressed due to low confidence (3)
internal/checker/nodebuilder.go:28
- The
visitedTypes
Set field is never initialized inenterContext
, leading to nil-pointer panics when calling.Has
or.Add
. Initialize it, e.g.,visitedTypes: collections.NewSet[TypeId](),
.
inferTypeParameters: make([]*Type, 0),
internal/collections/multimap.go:63
- Consider adding unit tests for the new
Values
method to verify it returns the expected sequence of value slices.
func (s *MultiMap[K, V]) Values() iter.Seq[[]V] {
internal/checker/nodebuilderimpl.go:242
- Calling
fmt.Sprintf
here requires importing thefmt
package. Addimport "fmt"
to the file's import block.
text := fmt.Sprintf("... %d more ...", len(list)-2)
|
||
if b.checkTruncationLength() { | ||
if !isBareList { | ||
var node *ast.Node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This entire block is unused per codecov, so not sure what the deal is there; it might not even be used in Strada
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's triggered by some LS tests in Strada? I vaguely remember adding this truncation check (along with the hard cut at the top level) in response to an LS request freezing the editor with a 50MB hover.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. mapToTypeNodes
was still a shorthand from the initial printer. Probably shoulda had a // !!!
on it as a reminder that it still needed work.
These are things I found while trying to work through #988.